﻿using Microsoft.Extensions.Configuration;

namespace _02_Configuration.Extensions.Ison
{
    public class IsonConfigurationSource : IConfigurationSource
    {
        public string? Url { get; set; }
        public bool ReloadOnChange { get; set; }

        public IsonConfigurationSource()
        {

        }

        public IsonConfigurationSource(string url)
        {
            Url = url;
        }

        public IConfigurationProvider Build(IConfigurationBuilder builder)
        {
            if (Url == null)
            {
                throw new ArgumentNullException(nameof(Url));
            }
            return new IsonConfigurationProvider(this);
        }
    }
}
